package com.lzs.adx.web.modules.adx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzs.adx.commmon.service.impl.CrudServiceImpl;
import com.lzs.adx.web.modules.adx.dao.WphOrderDao;
import com.lzs.adx.web.modules.adx.dto.WphOrderDTO;
import com.lzs.adx.web.modules.adx.entity.WphOrderEntity;
import com.lzs.adx.web.modules.adx.service.WphOrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 
 *
 * @author wangzhijun 825400558@qq.com
 * @since 1.0.0 2025-02-20
 */
@Service
public class WphOrderServiceImpl extends CrudServiceImpl<WphOrderDao, WphOrderEntity, WphOrderDTO> implements WphOrderService {

    @Override
    public QueryWrapper<WphOrderEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String stime = (String)params.get("stime");
        String etime = (String)params.get("etime");
        String status = (String)params.get("status");
        String channel_tag = (String)params.get("channelTag");

        QueryWrapper<WphOrderEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.ge(StringUtils.isNotBlank(stime) ,"order_time",stime);
        wrapper.le(StringUtils.isNotBlank(etime) ,"order_time",etime);
        wrapper.eq(StringUtils.isNotBlank(status), "status", status);
        wrapper.eq(StringUtils.isNotBlank(channel_tag), "channel_tag", channel_tag);

        wrapper.orderByDesc("order_time");

        return wrapper;
    }


}